stack: Change ordering for removal
authorMatthias Clasen <mclasen@redhat.com>
Thu, 22 Oct 2020 14:02:22 +0000 (10:02 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 22 Oct 2020 14:05:17 +0000 (10:05 -0400)
Unparent the child widget before tearing down its
stack page. This is necessary so a11y can still access
the stack page accessible to emit change notification
when it learns that the child is removed.

gtk/gtkstack.c

index b97ebb54bb52895f3375b1ded14bf031eec4dd2e..e1a24b77634313bdfc2d8800e2992800294527a6 100644 (file)
@@ -1467,16 +1467,12 @@ stack_remove (GtkStack  *stack,
   if (child_info == NULL)
     return;
 
-  priv->children = g_list_remove (priv->children, child_info);
-  
   g_signal_handlers_disconnect_by_func (child,
                                         stack_child_visibility_notify_cb,
                                         stack);
 
   was_visible = gtk_widget_get_visible (child);
 
-  g_clear_object (&child_info->widget);
-
   if (priv->visible_child == child_info)
     {
       if (in_dispose)
@@ -1490,6 +1486,10 @@ stack_remove (GtkStack  *stack,
 
   gtk_widget_unparent (child);
 
+  g_clear_object (&child_info->widget);
+
+  priv->children = g_list_remove (priv->children, child_info);
+
   g_object_unref (child_info);
 
   if (!in_dispose &&